package com.springboot.show_web.endpoint;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 自定义事件端点
 * Created by yaosheng on 2019/12/1.
 */
//@Endpoint(id = "datetime")
public class DateTimeEndpoint {

    private String format = "yyyy-MM-DD HH:mm:ss";
    //显示监控指标
    //@ReadOperation
    public Map<String,Object> info(){
        Map<String,Object> info = new HashMap<>();
        info.put("name","Great");
        info.put("age",24);
        info.put("datetime",new SimpleDateFormat(format).format(new Date()));
        return info;
    }

    //@WriteOperation
    public void  setFormat(String foemat){
        this.format = format;
    }
}